<?
function display_perm($Key,$Title) {
	global $Values;
	$Perm='<input type="checkbox" name="perm_'.$Key.'" id="'.$Key.'" value="1"';
	if ($Values[$Key]) { $Perm.=" checked"; }
	$Perm.=' /> <label for="'.$Key.'">'.$Title.'</label><br />';
	echo $Perm;
}

show_header('Manage Permissions','validate');
echo $Val->GenerateJS('permform');
?>
<form name="permform" id="permform" method="post" action="" onsubmit="return formVal();">
<input type="hidden" name="action" value="permissions" />
<input type="hidden" name="id" value="<?=display_str($_REQUEST['id']); ?>" />
<?
if ($Err) {
	echo '<div class="error_message">'.$Err.'</div>';
} elseif ($Message) {
	echo '<div class="save_message">'.$Message.'</div>';
}
?>
<div class="linkbox">
	[<a href="tools.php?action=permissions">Back to permission list</a>]
	[<a href="tools.php">Back to Tools</a>]
</div>
<table class="permission_head">
	<tr>
		<td class="label">Permission Name</td>
		<td><input type="text" name="name" id="name" value="<?=display_str($Name)?>" /></td>
	</tr>
	<tr>
		<td class="label">Class Level</td>
		<td><input type="text" name="level" id="level" value="<?=display_str($Level)?>" /></td>
	</tr>
	<tr>
		<td class="label">Show on Staff page</td>
		<td><input type="checkbox" name="displaystaff" value="1" <? if ($DisplayStaff) { ?>checked<? } ?> /></td>
	</tr>
<? if (is_numeric($_REQUEST['id'])) { ?>
	<tr>
		<td class="label">Current users in this class</td>
		<td><?=number_format($UserCount)?></td>
	</tr>
<? } ?>
</table>
<?
include(SERVER_ROOT."/classes/permissions_form.php");
permissions_form();
?>
</form>
<? show_footer(); ?>
